<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI 搜索界面</title>
<link rel="stylesheet" type="text/css" href="css/hui.css" />
<style type="text/css">
#hui-header-sreach{width:75%; height:32px; padding:0px !important; line-height:32px; position:absolute; z-index:21; left:45px; top:6px;}
#hui-header-sreach input{width:100%; height:32px !important; line-height:32px !important; margin:0px !important; -webkit-appearance:none; -moz-appearance:none; appearance:none; border-radius:5px; border:0; background:#EFF3F6; font-size:14px; text-indent:30px;}
#hui-header-sreach::after{font-family:"hui-font"; content:'\e714'; display:block; position:absolute; z-index:22; width:28px height:32px; left:5px; top:0;}
#hui-hot-sreach{background:#FFFFFF; padding:10px;}
#hui-hot-sreach-title{line-height:38px; font-size:16px; font-weight:700;}
#hui-hot-sreach-keys{margin-top:8px;}
#hui-hot-sreach-keys a{display:block; border-radius:5px; float:left; margin:0 8px 8px 0px; padding:6px 10px; line-height:20px; font-size:13px; background:#EFF3F6;}
</style>
</head>
<body style="background:#F4F5F6;">
<header class="hui-header">
    <div id="hui-header-sreach">
        <input type="search" id="searchKey" placeholder="请输入股票编码(数字)" />
    </div>
</header>
<div class="hui-wrap">
    <div id="hui-hot-sreach">
        <div id="hui-hot-sreach-title">搜索历史</div>
        <div id="hui-hot-sreach-keys">
            <a href="javascript:hotSearch('300336');">新文化</a>
            <a href="javascript:hotSearch('300331');">苏大维格</a>
            <a href="javascript:hotSearch('300330');">华虹计通</a>
            <a href="javascript:hotSearch('300118');">东方日升</a>
            <a href="javascript:hotSearch('300115');">长盈精密</a>
            <a href="javascript:hotSearch('300117');">嘉寓股份</a>
        </div>
    </div>
        <div class="hui-list">
        <ul id="showList">
        </ul>
    </div>
</div>
<div id="hui-footer">
    <a href="javascript:hui.open('index.html');" id="nav-home">
        <div class="hui-footer-icons hui-icons-home"></div>
        <div class="hui-footer-text">首页</div>
    </a>
    <a href="javascript:hui.open('zixuan.html');" id="nav-news">
        <div class="hui-footer-icons hui-icons-picker"></div>
        <div class="hui-footer-text">选股</div>
    </a>
    <a href="javascript:hui.open('celue.html?_='+new Date().getTime());" id="nav-news">
        <div class="hui-footer-icons hui-icons-water-fall"></div>
        <div class="hui-footer-text">策略</div>
    </a>
    <a href="javascript:hui.open('msg.html');" id="nav-forum">
        <div class="hui-footer-icons hui-icons-forum"></div>
        <div class="hui-footer-text">消息</div>
    </a>
    <a href="javascript:hui.open('yonghu.html');" id="nav-my">
        <div class="hui-footer-icons hui-icons-my"></div>
        <div class="hui-footer-text">我的</div>
    </a>
</div>
<script type="text/javascript" src="js/hui.js" charset="UTF-8"></script>
<script type="text/javascript">
	hui('#searchKey').change(function(){
	    searchNow();
	});
//监听搜索按钮时间
document.getElementById('searchKey').addEventListener('keyup', function(e){if(e.keyCode == 13){searchNow();}});
function hotSearch(k){
    hui('#searchKey').val(k);
    searchNow();
}
function searchNow(){
    document.activeElement.blur();
    var kwd = hui('#searchKey').val();
    kwd = kwd.trim();
    if(kwd.length < 4){hui.toast('关键字至少4个字符'); return false;}
    
        	hui.post(
		    url_root+':8080/st/servlet/StockServlet',
		    {method:'searchGP', code:kwd},
		    function(data){
		    	var obj = eval(data);
		    	var p = /[0-9]/; 
		    	hui("#showList").html("");
		    	var pd =0;
		    	for (var i=0;i<obj.length;i++)
				{ 
					var b = p.test(obj[i].prod_name);//true,说明有数字
					if(b){
						continue;
					}
					if(obj[i].special_marker==0){
						continue;
					}
					
					var listr = "<li style='border-top:1px solid #929292;border-bottom:1px solid #929292;' onclick='javascript:openIm(\"%%%%\",\"----\");' ><span style='width:80%;'>####</span>!!!!</li>";
					listr = listr.replace("####",obj[i].prod_name);
					listr = listr.replace("----",obj[i].prod_name);
					listr = listr.replace("%%%%",obj[i].prod_code);
					listr = listr.replace("!!!!",obj[i].prod_code);
					hui("#showList").html(hui("#showList").html()+listr);
				    pd++;
				}
				if(pd==0){
					 hui.toast("没有结果");
				}
		    },
		    function(e){
		        hui.iconToast(e, 'warn');
		    }
		);
}
function openIm(data,name){
	localStorage.setItem("name",name);
	hui.open("dtl.html?_="+new Date().getTime()+"&code="+data);
}
</script>
</body>
</html>